<?php
	require("includes/functions.php");
	$id = checkSession();
	$name = $_POST['search'];
	$query="SELECT * FROM user_table WHERE firstName like '$name%' or lastName like '$name%'";
	$users = mysql_query($query);
	$userNum = mysql_num_rows($users);
?>
<?php include 'includes/header.php';?>
<div id="columns">
	<div id="column-1" class="column menu"></div>
	<div class="blocks">
	<center>
		<table class = 'post'>
			<tr><td><img src = "image/user_search.png"></td><td><h2>Search Results<h2></td></tr> 
			<tr><td colspan = '2'><hr style = 'height:0px; border-style:solid; border-width:2px 0 0 0;border-color:#ccc;}'/></td></tr>
			<?php for($i = 1; $i<=$userNum; $i++ ): ?>
			<?php $user = mysql_fetch_array($users); ?>
				<tr><td style = "text-align:right;"><img src = "user_images/<?php echo $user['url']; ?>" height="50px" width="50px"></td><td style = "text-align:left;"><a href='viewProfile.php?id=<?php echo $user['userId']; ?>'><?php echo $user['firstName']." ".$user['lastName']; ?></a></td></tr>
			<?php endfor; ?>
		</table>
	</center>
	</div>
	<div id="column-3" class="column sidebar"></div>		
</div>
<?php include 'includes/footer.php';?>	